<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<div class="sidebar ">
	<div class="sidebar-collapse">
		<div class="sidebar-header t-center" style="margin-bottom: 20px;">
			<img class="text-logo" src="/assets/img/logo.png">
		</div>
		<div class="sidebar-menu">
			<ul class="nav nav-sidebar">
				<li><a href="index.do"><i class="fa fa-laptop"></i><span
						class="text">首页</span></a></li>
				<li code="1_1"><a href="/manager/shop.do"><i class="fa fa-file-text"></i><span
						class="text">商家管理</span></a></li>
				<li code="1_2"><a href="/manager/shop-approve.do"><i
						class="fa fa-file-text"></i><span class="text">审批管理</span></a></li>
				<li code="1_3"><a href="/manager/advertise.do"><i
						class="fa fa-file-text"></i><span class="text">广告管理</span></a></li>
				<li code="1_4"><a href="/manager/order.do"><i
						class="fa fa-file-text"></i><span class="text">订单管理</span></a></li>
				<li code="1_5"><a href="/manager/refund.do"><i
						class="fa fa-file-text"></i><span class="text">退款管理</span></a></li>
				<li code="1_6"><a href="/manager/user.do"><i class="fa fa-file-text"></i><span
						class="text">用户管理</span></a></li>
				<li code="1_7"><a href="/manager/blacklist.do"><i
						class="fa fa-file-text"></i><span class="text">黑名单管理</span></a></li>
				<li code="1_8"><a href="#"><i class="fa fa-list-alt"></i><span
						class="text">优惠券管理</span></a>
					<ul class="nav sub">
						<li><a href="/manager/coupon.do"><i class="fa fa-file-text"></i><span
								class="text">查看平台优惠券</span></a></li>
						<li><a href="/manager/couponDetails.do"><i class="fa fa-file-text"></i><span
								class="text">查看平台优惠券使用详情</span></a></li>
					</ul></li>
				<li code="1_9"><a href="/manager/brand.do"><i
						class="fa fa-file-text"></i><span class="text">品牌管理</span></a></li>
				<li code="1_10"><a href="/manager/goods.do"><i
						class="fa fa-file-text"></i><span class="text">商品推荐</span></a></li>
				<li code="1_11"><a href="/manager/broadcast.do"><i
						class="fa fa-file-text"></i><span class="text">消息管理</span></a></li>
				<li code="1_12"><a href="/manager/address.do"><i
						class="fa fa-file-text"></i><span class="text">地区管理</span></a></li>
				<li code="1_13"><a href="/manager/category.do"><i
						class="fa fa-file-text"></i><span class="text">商品分类</span></a></li>
				<li code="1_14"><a href="/manager/int_category.do"><i
						class="fa fa-file-text"></i><span class="text">国际分类</span></a></li>
				<li code="1_15"><a href="/manager/industry_category.do"><i
						class="fa fa-file-text"></i><span class="text">行业分类</span></a></li>
				<li code="1_16"><a href="/manager/barCode.do"><i
						class="fa fa-file-text"></i><span class="text">封条管理</span></a></li>
				<li code="1_17"><a href="/manager/statistical.do"><i
						class="fa fa-file-text"></i><span class="text">统计管理</span></a></li>
				<!-- <li><a href="/manager/statistical2.do"><i class="fa fa-file-text"></i><span
                        class="text">统计管理</span></a></li> -->
				<li code="1_18"><a href="/manager/system-info.do"><i
						class="fa fa-file-text"></i><span class="text">平台管理</span></a></li>
				<li code="1_19"><a href="/manager/points.do"><i
						class="fa fa-file-text"></i><span class="text">支付点数管理</span></a></li>
				<li code="1_20"><a href="/manager/proprietary.do"><i
						class="fa fa-file-text"></i><span class="text">自营店管理</span></a></li>
				<li code="1_21"><a href="/manager/supplier.do"><i
						class="fa fa-file-text"></i><span class="text">供应商管理</span></a></li>
				<li code="1_22"><a href="/manager/delivery.do"><i
						class="fa fa-file-text"></i><span class="text">配送商管理</span></a></li>
				<li code="1_23"><a href="/manager/buildIndexPage.do"><i
						class="fa fa-file-text"></i><span class="text">生成首页</span></a></li>
				<li code="1_32"><a href="javascript:;"><i
						class="fa fa-file-text"></i><span class="text" id="rebuildGoodsPage">生成所有商品页</span></a></li>
				<li code="1_24"><a href="javascript:;"><i
						class="fa fa-file-text"></i><span class="text" id="buildQQG">生成全球购</span></a></li>
				<li code="1_25"><a href="/manager/rebatelink.do"><i
						class="fa fa-file-text"></i><span class="text">返利管理</span></a></li>
				<li code="1_26"><a href="/manager/rebate.do"><i
						class="fa fa-file-text"></i><span class="text">返利审核</span></a></li>
				<li code="1_27"><a href="/manager/adminuser.do"><i
						class="fa fa-file-text"></i><span class="text">后台用户管理</span></a></li>
				<li code="1_28"><a href="/manager/role.do"><i
						class="fa fa-file-text"></i><span class="text">角色管理</span></a></li>
				<li code="1_29"><a href="/manager/searchKeyword.do"><i
						class="fa fa-file-text"></i><span class="text">搜索关键字推荐管理</span></a></li>
				<li code="1_30"><a href="/manager/groupBuy.do"><i
						class="fa fa-file-text"></i><span class="text">团购精品推荐</span></a></li>
				<li code="1_31"><a href="/manager/categoryIcon.do"><i
						class="fa fa-file-text"></i><span class="text">一级分类图标管理</span></a></li>
				<li code="1_33"><a href="/manager/footerInfo.do"><i
						class="fa fa-file-text"></i><span class="text">底部文章管理</span></a></li>
				<li code = "1_34"><a href = "/manager/withdrawal.do"><i
						class= "fa fa-file-text"></i><span class="text">提现管理</span></a></li>
				<li code = "1_35"><a href = "/manager/givevalue.do"><i
						class= "fa fa-file-text"></i><span class="text">充值管理</span></a></li>
				<li code = "1_36"><a href = "/manager/customerflow.do"><i
						class= "fa fa-file-text"></i><span class="text">客户消费</span></a></li>
				<li code = "1_37"><a href = "/manager/balance.do"><i
						class= "fa fa-file-text"></i><span class="text">余额积分管理</span></a></li>
				<li code = "1_38"><a href = "/manager/labelling.do"><i
						class= "fa fa-file-text"></i><span class="text">标签查询</span></a></li>
			</ul>
		</div>
	</div>
	<div class="sidebar-footer">
		<h3 style="text-align: center; font-weight: bold; font-family: 楷体">运营管理平台</h3>
		<div class="copyright text-center">
			<!-- <small><a href="https://www.baidu.com/" title="公司名" target="_blank">公司名</a></small> -->
		</div>
	</div>
</div>
<script type="text/javascript">
	$(function() {
		$.get("/manager/getPermCodes.do", function(result) {
			if (result.code) {
				var array = result.data.split(",");
				if (array != null) {
					$(".sidebar-menu").find("li").each(function(a, b) {
						var code = $(this).attr("code");
						if (code) {
							if ($.inArray(code, array) > -1) {
								$(this).show();
							} else {
								$(this).hide();
							}
						}
					});

				}
			}
		});

		$("#buildIndex").click(function() {
			var index = layer.confirm('确定生成商城首页吗？', {
				btn : [ '确定', '放弃' ]
			//按钮
			}, function() {
				$.ajax({
					url : "/manager/buildIndex.do",
					type : "post",
					data : $("#floor").serialize(),
					success : function(result) {
						layer.msg(result.msg);
						layer.close(index);
						if (result.code) {
						}
					}
				});
				/* $.get("manager/buildIndex.do", function(result) {
				    layer.msg(result.msg);
				    layer.close(index);
				    if (result.code) {
				    }
				});*/
			}, function() {
			});
		});

		// 由于生成所有商品页耗时较长，为了避免客户端等待结果，服务端开了一条线程在跑
		function getBuildGoodsPageState() {
            $.ajax({
                url: "/manager/getBuildGoodsPageState.do",
                async: false,
                success: function (data) {
                    if (data.code == "0") {
                        layer.msg(data.msg);
                        clearInterval(buildState);
                    }
                }
            })
        }
        // 此处ajax每3秒请求一次服务器端获取生成结果
        var buildState;


		$("#rebuildGoodsPage").click(function(){
		    var index = layer.confirm('确定生成所有的商品页吗？',{
		        btn:['确定','放弃']
			},function(){
					$.ajax({
						url : "/manager/buildGoodsPage.do",
						async : false,
						success : function(result) {
							layer.msg(result.msg);
							layer.close(index);
							buildState = setInterval(
									"getBuildGoodsPageState()", 3 * 1000);
							if (result.code) {
							}
							}
						})
					}, function() {
					});
				});

		$("#buildQQG").click(function() {
			var index = layer.confirm('确定生成商城全球购吗？', {
				btn : [ '确定', '放弃' ]
			//按钮
			}, function() {
				$.get("/manager/buildQuangqiugou.do", function(result) {
					layer.msg(result.msg);
					layer.close(index);
					if (result.code) {
					}
				});
			}, function() {
			});
		});
	});
</script>